<!-- <template>
    <van-button type="primary" @click="store.setUser({openid:'22222'})">主要按钮</van-button>
    <p>{{ store.user }}</p>
    
</template>
<script lang="ts" setup>
import { Button as VanButton } from 'vant'

import { useUserStore } from '@/stores/user'

const store=useUserStore()
</script>
<style scoped></style> -->
<template>
    <div class="container">
        <div class="header">
            <van-image fit="contain" src="/wxchat/images/notice.png" />
            <div class="title">
                <span class="text">
                    质检不合格通知
                </span>
            </div>
        </div>
        <div class="body">
            <van-cell-group v-for="(item, index) in list" :key="index"
                style="margin-bottom: 15px;  background-color: #6F6F6F;">
                <van-cell title="编号" :value="item.partid" />
                <van-cell title="名称" :value="item.partname" />
                <van-cell title="检验员" :value="item.qc" />
                <van-cell title="问题" :label="item.content" :value="item.create" />
            </van-cell-group>
        </div>
    </div>
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import { Image as VanImage, Cell as VanCell, CellGroup as VanCellGroup, showNotify } from 'vant';
import type { qc } from '@/types/data'
import { getQcApi } from '@/api/index'
import { useRoute } from 'vue-router'
import router from '@/router'

var route = useRoute()
const list = ref<qc[]>([
    // {
    //     partid: 'IT9501-WX',
    //     partname: '商用跑步机',
    //     amount: 100,
    //     qc: '张三',
    //     create: '2023-10-12',
    //     content: '质检检验不合格'
    // },
    // {
    //     partid: 'IT9502-WX',
    //     partname: '家用跑步机',
    //     amount: 400,
    //     qc: '张思',
    //     create: '2023-10-12',
    //     content: '质检检验不合格'
    // }
])

onMounted(() => {
    let openid = route?.params.openid
    if (openid) {
        getQcApi(openid as string).then(({ data }) => {
            // console.log(data)
            list.value = data
        }).catch((err) => {
            showNotify(
                { type: 'warning', message: '未查询到信息' }
            );
        })
    }
    else {
        router.replace({
            name: '404'
        })
    }
})
</script>
<style lang="scss" scoped></style>